package com.weiyi.mashangzhu.easemob.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class ChatHelper extends SQLiteOpenHelper {

    private static ChatHelper instance;

    private ChatHelper(Context context) {
        super(context, "mashangzhuim.db", null, 1);
    }

    public static ChatHelper getInstance(Context context) {
        if (instance == null) {
            instance = new ChatHelper(context.getApplicationContext());
        }
        return instance;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table " + ChatDao.TABLE_NAME +
                "(_id integer primary key autoincrement, " +
                ChatDao.ACCOUNT + " text, " +
                ChatDao.NICK + " text, " +
                ChatDao.AVATAR + " text)"
        );
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
